#ifndef ARTICLEUPDATER_H
#define ARTICLEUPDATER_H

#include <QObject>

class QNetworkReply;
class QNetworkAccessManager;
class ArticleUpdater : public QObject
{
    Q_OBJECT
public:
    explicit ArticleUpdater(QObject *parent = nullptr);

    // 设置请求模式（同步或异步）
    void setSyncMode(bool sync);

    void updateArticle(struct Article article);
    void updateArticle(uint articleID, const QString& title, const QString& content, const QList<QString>& images);

signals:
    void articleUpdated(bool success, const QString& message);

private slots:
    void onRequestFinished(QNetworkReply* reply);

private:
    QNetworkAccessManager* httpManager;
    bool isSync; // 请求模式标志位
};

#endif // ARTICLEUPDATER_H
